package com.csce.domain.entity.score;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.doudou.core.container.ListUtil;
import com.doudou.core.str.StrUtil;
import com.doudou.core.date.DateUtil;
import com.osce.common.annotation.Excel;
import com.osce.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.util.Date;
import java.util.List;

/**
 * 考试场次对象 score_ex_exam_session
 *
 * @author zzx
 * @since 2023-09-07
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@ToString
@EqualsAndHashCode(callSuper = true)
public class ScoreExExamSession extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ApiModelProperty("${comment}")
    private Long id;

    /**
     * 考试编号
     */
    @Excel(name = "考试编号")
    @ApiModelProperty("考试编号")
    private Long examId;

    /**
     * 考试考场编号
     */
    @Excel(name = "考试考场编号")
    @ApiModelProperty("考试考场编号")
    private Long examPlaceId;

    /**
     * 考试考场序号
     */
    @Excel(name = "考试考场序号")
    @ApiModelProperty("考试考场序号")
    private Integer examPlaceIndex;

    /**
     * 考试日期
     */
    @Excel(name = "考试日期")
    @ApiModelProperty("考试日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date date;
    private String dateStr;

    /**
     * 时间分段编号
     */
    @Excel(name = "时间分段编号")
    @ApiModelProperty("时间分段编号")
    private Long timeId;

    /**
     * 现场考官
     */
    @Excel(name = "现场考官")
    @ApiModelProperty("现场考官")
    private Long sceneExaminer;

    /**
     * 中控考官
     */
    @Excel(name = "中控考官")
    @ApiModelProperty("中控考官")
    private Long centerExaminer;

    /**
     * 远程考官
     */
    @Excel(name = "远程考官")
    @ApiModelProperty("远程考官")
    private Long sshExaminer;

    /**
     * 标准化病人
     */
    @Excel(name = "标准化病人")
    @ApiModelProperty("标准化病人")
    private Long simulatedPatient;

    /**
     * 考试分配学员信息
     */
    private List<ScoreExExamPlaceAllot> scoreExExamPlaceAllotList;

    public String getDateStr() {
        if (StrUtil.isBlank(this.dateStr)) {
            this.dateStr = DateUtil.formatDate(this.date);
        }
        return this.dateStr;
    }

    public List<Long> examinerList(){
        return ListUtil.newArrayList(this.sceneExaminer,this.centerExaminer,this.sshExaminer);
    }
}
